<%--
  Created by IntelliJ IDEA.
  User: admin
  Date: 2024/11/27
  Time: 11:45
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<script type="test/javascript"src="{$pageContext.request.contextPath}/js/jquery.min.js"/>
<script type="text/javascript">
    function register(){
        let username = document.getElementById("username").value;
        let password = document.getElementById("password").value;
        let jsonData = {"username": username,"password": password}
        let jsonObj = JSON.stringify(jsonData);


        $.ajax({
            type:"post",
            contentType:'application/json;charaset=utf-8',
            data:jsonObj,
            url:'{pageContext.request.context.contextPath}/stu/insert.do',
            success:function(respData){
                alter(respData.username+":"+respData.password)
            }
        })
    }
</script>
<html>
<head>
    <title>Title</title>
</head>
<body>
<form action="${pageContext.request.contextPath}/stu/addStu1.do">
用户名：<input type="text" name="username" id="username"><br>
密码：<input type="text" name="password" id="password"><br>
<input type="button" value="注册" onclick="register()">

</form>
</body>
</html>
